<?php
class Training_Model_NewsArticle extends Zend_Db_Table{
	
	protected $_name = 'news_article';
	protected $_primary = 'id';
	
	public function listItem($arrParam, $options = null){
		$db = $this->getDefaultAdapter();
		
		// Training_LoadContentController - indexAction
		if($options['task'] == 'list-news-article'){
			$select = $db->select()
						 ->from($this->_name,array('id','article_title','article_content'));
			
			if(empty($arrParam['position'])) {
				$select->limit(5,0);
			}else {
				$select->limit(2,$arrParam['position']);
			}

			$result = $db->fetchAll($select);
		}
		return $result;
	}	
}